using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UwinEducation.Domain.Entities;
using UwinEducation.Shared.Models;

namespace UwinEducation.Domain.IRepositories
{
    /// <summary>
    /// 订单折扣仓储接口
    /// </summary>
    public interface IOrderDiscountRepository : IRepository<OrderDiscount, Guid>
    {
        /// <summary>
        /// 根据订单ID获取折扣列表
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <returns>订单折扣列表</returns>
        Task<List<OrderDiscount>> GetByOrderIdAsync(Guid orderId);
        
        /// <summary>
        /// 根据多个订单ID获取折扣列表
        /// </summary>
        /// <param name="orderIds">订单ID列表</param>
        /// <returns>订单折扣列表</returns>
        Task<List<OrderDiscount>> GetByOrderIdsAsync(List<Guid> orderIds);
        
        /// <summary>
        /// 分页获取订单折扣
        /// </summary>
        /// <param name="request">分页请求参数</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<OrderDiscount>> GetPagedAsync(OrderDiscountPageRequest request);
        
        /// <summary>
        /// 批量添加订单折扣
        /// </summary>
        /// <param name="discounts">订单折扣列表</param>
        /// <returns>操作结果</returns>
        Task AddRangeAsync(List<OrderDiscount> discounts);
        
        /// <summary>
        /// 批量更新订单折扣
        /// </summary>
        /// <param name="discounts">订单折扣列表</param>
        /// <returns>操作结果</returns>
        Task UpdateRangeAsync(List<OrderDiscount> discounts);
        
        /// <summary>
        /// 批量删除订单折扣
        /// </summary>
        /// <param name="discounts">订单折扣列表</param>
        /// <returns>操作结果</returns>
        Task DeleteRangeAsync(List<OrderDiscount> discounts);
        
        /// <summary>
        /// 计算订单的总折扣金额
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <returns>总折扣金额</returns>
        Task<decimal> GetTotalDiscountAmountAsync(Guid orderId);
        
        /// <summary>
        /// 计算多个订单的总折扣金额
        /// </summary>
        /// <param name="orderIds">订单ID列表</param>
        /// <returns>每个订单ID对应的总折扣金额字典</returns>
        Task<Dictionary<Guid, decimal>> GetTotalDiscountAmountByOrderIdsAsync(List<Guid> orderIds);
    }
} 